<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="com.cqggrw.util.*"%>
<%@ page import="com.cqggrw.domain.*"%>
<%@ page import="com.cqggrw.service.*"%>
<%@ page import="com.cqggrw.service.impl.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>公共人物网后台管理</title>
<link type="text/css" rel="Stylesheet" href="../Content/tabbed_pages.css" />
<link type="text/css" rel="Stylesheet" href="../Content/Index.css" />
<script type="text/javascript" src="../../jslib/calendar.js"></script>
<script type="text/javascript" src="../../jslib/jquery-1.8.0.min.js"></script>
<script type="text/javascript">

function WebForm_OnSubmit() {
	if($('#nameId').val().length == 0) {
		$('#nameSpan').html('<font color="red">*必填项目</font>');
		return false;
	}
	if($('#addDateId').val().length == 0) {
		$('#addDateSpan').html('<font color="red">*必填项目</font>');
		return false;
	}
	if($('#peopleNameId').val().length == 0) {
		$('#peopleNameSpan').html('<font color="red">*必填项目</font>');
		return false;
	}
	if($("#imgId").val() != '') {
		if($("#imgId").val().indexOf('.zip') == -1) {
			$('#imgSpan').html('<font color="red">*请选择zip文件格式的杂志压缩包</font>');
		}
	}
	if($('#desId').val().length == 0) {
		$('#desSpan').html('<font color="red">*必填项目</font>');
		return false;
	}
	return true;
}

</script>
</head>
<%
	BookServiceI bookService = new BookServiceImpl();
	String idStr = request.getParameter("id");
	Book book = new Book();
	if(idStr != null&&idStr.length()>0) {
		book = bookService.get(Integer.parseInt(idStr));
	}
%>
<body>
	<form name="form1" method="post" action="bookAction!modify.action" onsubmit="javascript:return WebForm_OnSubmit();" id="form1" enctype="multipart/form-data">
	<input name="id" type="hidden" value="<%=book.getId() %>"/>
	<input name="fmImgFileName2" type="hidden" value="<%=book.getFmImgFileName() %>"/>
		<div class="form-div textLeft">
			<h1>
				<span class="action-span"><a href="BookList.jsp">杂志列表</a>
				</span> <span class="action-span1 fs20">公共人物网 管理中心 </span><span class="action-span1 paddingTop5"> - 分类编辑 </span>
			</h1>
			<div style="clear:both"></div>
		</div>
		<div id="gallery">
			<div class="on" title="CommonInfo">
				<span>分类信息</span>
			</div>
			<%
				String message = (String)request.getAttribute("message");
				if(message != null) {
					out.print(message);
				}
			%>
		</div>
		<div id="CommonInfo" class="show">
			<table width="90%" id="general-table" align="center">
				<tr>
					<td>杂志名称： <input name="name" type="text" id="nameId" value="<%=book.getName() %>" /> <span id="nameSpan"></span></td>
				</tr>
				<tr>
					<td>添加时间： <input name="addDate" value="<%=book.getAddDate() %>" type="text" maxlength="10" id="addDateId" /> <input name="selbtn1" type="button" id="selbtn1" onclick="new Calendar().show(this.form.addDate);" value="选择" class="button" /> <span id="addDateSpan"></span>
					</td>
				</tr>
				<tr>
					<td>封面人物： <input name="peopleName" value="<%=book.getPeopleName() %>" type="text" id="peopleNameId" /> <span id="peopleNameSpan"></span></td>
				</tr>
				<tr>
					<td>封面图片： <input name="fmImg" type="file"  id="fmImgId" />
					<span id="fmImgSpan"></span></td>
				</tr>
				<tr>
					<td>上传杂志： <input name="img" type="file"   id="imgId" />
					<span id="imgSpan"></span></td>
				</tr>
				<tr>
					<td>杂志描述： <textarea name="des" id="desId" style="font-weight: normal;font-size: 14px;" rows="2" cols="40"> <%=book.getDes() %></textarea>
					<span id="desSpan"></span></td>
				</tr>
				<tr>
					<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="imgSpan"></span></td>
				</tr>
			</table>
		</div>
		<div class="form-div textLeft" style="text-align:center;margin-top:5px;">
			<input type="submit" name="btnSave" value="保存" onclick="" id="btnSave" class="button" />
		</div>
	</form>
</body>
</html>